#include <iostream>
using namespace std;

const int N = 1e5;
int n, r[N + 3];
int main() {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    int maximum = 0, flag = 1;
    for (int i = 1; i <= n; i++) {
        cin >> r[i], maximum = max(maximum, r[i]);
        if (r[i] != 1 && r[i] != 2) flag = 0;
    }
    int ans = 0;
    if (flag) {
        for (int i = 1; i <= n; i++) if (r[i] == 2) ans++;
        cout << ans << '\n';
        return 0;
    }
    for (int i = 1; i <= n; i++) if (r[i] == maximum) ans++;
    cout << n - ans << '\n';
    return 0;
}
